{template '../../header'}
{template '../../left'}

<div class="card">
    <div class="card-header">
        广告管理
    </div>
    <div class="card-body">
        <div class="row mb-3">
            <div class="col-12">
                <a href="/admin/cms/ads/edit" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> 添加</a>
            </div>
        </div>
        <form method="post">
            <table class="table table-sm table-striped table-hover">
                <thead>
                <th>
                    ID
                </th>
                <th>
                    位置
                </th>
                <th>
                    图片
                </th>
                <th>
                    标题
                </th>
                <th>
                    链接
                </th>
                <th>
                    排序
                </th>
                <th>
                    状态
                </th>
                <th>
                    编辑
                </th>
                <th>
                    删除
                </th>
                </thead>
                <tbody>
                    {loop $rows $row}
                    <tr>
                        <td>
                            {$row['id']}
                        </td>
                        <td>
                            {$row['position_title']}
                        </td>
                        <td>
                            <img src="{$row['image']}" style="width: 2rem; height: 1.5rem;" />
                        </td>
                        <td>
                            {$row['title']}
                        </td>
                        <td>
                            {$row['url']}
                        </td>
                        <td>
                            <input type="text" class="form-control form-control-sm" size="2" name="sorts[{$row['id']}]" value="{$row['sort']}" />
                        </td>
                        <td>
                            {$row['state_title']}
                        </td>
                        <td>
                            <a class="btn btn-primary btn-sm" href="/admin/cms/ads/edit?id={$row['id']}"><i class="fa fa-edit"></i></a>
                        </td>
                        <td>
                            <button type="button" class="btn btn-danger btn-sm"  onclick="confirm('你确定要删除吗？') && (location.href='/admin/cms/ads/remove?id={$row['id']}')"><i class="fa fa-trash-o"></i></button>
                        </td>
                    </tr>
                    {/loop}
                </tbody>
            </table>
            <div class="row mb-3">
                <div class="col-12">
                    <button type="submit" class="btn btn-primary btn-sm mr-3" name="do" value="sort"><i class="fa fa-sort-amount-desc"></i> 保存排序</button>
                </div>
            </div>
        </form>
        {template '../../page'}
    </div>
</div>

{template '../../footer'}   